Running Automated Tests
Adding test automation to your build pipelines supports continuous integration, and allows you to implement and test new features as early as possible.
In Eggplant DAI, you can trigger a set of tests, or test configuration, from the command line. To do this, you need to install and run a CLI tool:
-
Download the CLI for your platform. The following platforms are supported:
- Windows
- OSX: Big Sur and Monterey
- Linux: CentOS 7 and Ubuntu 16.
-
Run the
.exe
from the command line. Refer Run test config:The
.exe
runs until the test config is complete.- If the test config runs successfully, it will complete with an exit code of
0
. - Other exit codes indicate that the test config has failed.
- If the test config runs successfully, it will complete with an exit code of
Run Test Configuration by Test Config Id
When creating a test configuration, each test configuration will be assigned a unique identifier (TEST_CONFIG_ID
).
To retrieve this ID, go to Controller > Test Config and edit the test configuration that you want to run. The TEST_CONFIG_ID
value is appended to the URL.
.
Other mandatory options:
Parameter | Value Description |
---|---|
SERVER_URL | URL for the Eggplant DAI server. For example: https://myeggplantserver.com |
--client-id <CLIENT_ID> --client-secret <CLIENT_SECRET> | Retrieve the client secret pair set up during installation. For security, you might want to set the DAI_CLIENT_SECRET environment variable instead of passing your credentials on the command line. |
At your command line, run the following command:
eggplant-runner-Windows-6.1.2.exe <SERVER_URL> <TEST_CONFIG_ID> --client-id=<CLIENT_ID> --client-secret=<CLIENT_SECRET>
For more configuration settings, see advanced options.
Run Test Configuration by Test Config Name
Alternatively, you can also run a test configuration by using the test config name configured in DAI server, along with its model name or suite name. You can find this information from Controller > Test Config.
Other mandatory options:
Parameter | Value Description |
---|---|
SERVER_URL | URL for the Eggplant DAI server. For example: https://myeggplantserver.com |
--client-id <CLIENT_ID> --client-secret <CLIENT_SECRET> | Retrieve the client secret pair set up during installation. For security, you might want to set the DAI_CLIENT_SECRET environment variable instead of passing your credentials on the command line. |
Model based Test Configuration
To run a model-based test configuration, retrieve the values for following options from your test configuration:
Parameter | Value Description |
---|---|
--test-config-name <TEST_CONFIG_NAME> | DAI test configuration name that you want to run. |
--model-name <MODEL_NAME> | DAI model name for the specified test configuration. |
At your command line, run the following command:
eggplant-runner-Windows-6.1.2.exe modelbased <SERVER_URL> --test-config-name=<TEST_CONFIG_NAME> --model-name=<MODEL_NAME> --client-id=<CLIENT_ID> --client-secret=<CLIENT_SECRET>
Script based Test Configuration
To run a script-based test configuration, retrieve the values for following options from your test configuration:
Parameter | Value Description |
---|---|
--test-config-name <TEST_CONFIG_NAME> | DAI test configuration name that you want to run. |
--suite-name <SUITE_NAME> | DAI suite name for the specified test configuration. |
At your command line, run the following command:
eggplant-runner-Windows-6.1.2.exe scriptbased <SERVER_URL> --test-config-name=<TEST_CONFIG_NAME> --suite-name=<SUITE_NAME> --client-id=<CLIENT_ID> --client-secret=<CLIENT_SECRET>
For more configuration settings, see advanced options.
Advanced Options
Advanced options are optional but do allow you to fine-tune test executions. For an up-to-date list, run the --help
option.
Option | Description |
---|---|
--request-timeout INTEGER | Timeout in seconds for each HTTP request to the DAI server. Default: 30 |
--request-retries INTEGER | Number of times to attempt each HTTP request to the DAI server. Default: 5 |
--backoff-factor FLOAT | Exponential backoff factor between each HTTP request. Default: 0.5 |
--poll-interval INTEGER | Number of seconds to wait between each call to the DAI server. Default: 5 |
--test-environment-timeout INTEGER | The timeout in seconds for checking test environment readiness. Default: 15 |
--log-level TEXT | Logging level. Default: INFO |
--ca-cert-path PATH | Path to an alternative Certificate Author pem file |
--test-result-path PATH | Path to a file where the test results will be stored in junit xml format |
--version | Shows the version number and exits |
--dry run / --no-dry-run | Perform a dry run only. Default: no-dry-run |